OsPath build flag no longer depends on filepath-bytestring
authorJoey Hess <joeyh@joeyh.name>
Mon, 10 Feb 2025 20:25:31 +0000 (16:25 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 10 Feb 2025 20:39:55 +0000 (16:39 -0400)
commit2ff716be30493cc6025d9da1767d9481dee44f9e
tree9384cee29e0bee7d1b02ffce8308998caac680ff
parentce697aa8aef6bbda72761f75a7e6beb261b31cfd
OsPath build flag no longer depends on filepath-bytestring

However, filepath-bytestring is still in Setup-Depends.
That's because Utility.OsPath uses it when not built with OsPath.
It would be maybe possible to make Utility.OsPath fall back to using
filepath, and eliminate that dependency too, but it would mean either
wrapping all of System.FilePath's functions, or using `type OsPath = FilePath`

Annex.Import uses ifdefs to avoid converting back to FilePath when not
on windows. On windows it's a bit slower due to that conversion.
Utility.Path.Windows.convertToWindowsNativeNamespace got a bit
slower too, but not really worth optimising I think.

Note that importing Utility.FileSystemEncoding at the same time as
System.Posix.ByteString will result in conflicting definitions for
RawFilePath. filepath-bytestring avoids that by importing RawFilePath
from System.Posix.ByteString, but that's not possible in
Utility.FileSystemEncoding, since Setup-Depends does not include unix.
This turned out not to affect any code in git-annex though.

Sponsored-by: Leon Schuermann
13 files changed:
Annex/Import.hs
Backend/Hash.hs
Backend/Utilities.hs
Command/AddUrl.hs
Database/RawFilePath.hs
Git/Tree.hs
Types/GitConfig.hs
Utility/FileSystemEncoding.hs
Utility/OpenFd.hs
Utility/OsPath.hs
Utility/Path/Windows.hs
Utility/Touch.hs
git-annex.cabal